import React,{useState,useEffect} from 'react'
import '../../assets/paymentSuccess/index.less'
import Axios from 'axios'
function PaymentSuccess(props:any) {
  let [orderObj,setorderObj] = useState<any>({})
  useEffect(()=>{
    Axios.get('/getPaymentSuccess').then(res=>{
      setorderObj(orderObj=res.data.data.list)
      // console.log(orderObj)
    })
  },[])
  return (
    <div className='paymentSuccess'>
      <div className='paymentSuccess_yes'>
          <div className='paymentSuccess_yes_img'>
            <img src={require('../../assets/duihao.png')} alt=""/>
          </div>
          <div className='paymentSuccess_yes_font'>
            <h3>订单支付成功!</h3>
          </div>
      </div>
      <div className='paymentSuccess_main'>
        <div className='paymentSuccess_main_obj'>
          <div className='paymentSuccess_main_obj_one'>
            <p><span>订单编号:</span><span className='left_span'>{orderObj.orderid}</span></p>
            <p><span>实付金额:</span><span  className='left_spans'>{orderObj.price}</span></p>
            <p><span>支付方式:</span><span  className='left_span'>{orderObj.way}</span></p>
          </div>
          <div className='paymentSuccess_main_obj_two'>
            <p><span>收货人:</span><span  className='left_span'>{orderObj.name}</span></p>
            <p><span>收获地址:</span><span  className='left_span'>{orderObj.city}</span></p>
          </div>
          
          
        </div>
      </div>
      <div className='paymentSuccess_btn'>
        <div className='paymentSuccess_btn'>
          <button className='btn_one' onClick={()=>{
            props.history.push('/orderList')
          }}>
            查看订单
          </button>
          <button className='btn_two' onClick={()=>{
            props.history.push('/home')
          }}>
            返回首页
          </button>
        </div>
        
      </div>
    </div>
  )
}

export default PaymentSuccess
